/**
 * Created by liyun on 2015/10/27.
 */
var fs = require("fs");
var debug = require('debug')('routes:material');
require('date-utils');
var Material = require('../models/material');
var Sim = require('../models/sim');
var config=require('../config/settings');
var BoxBuyer = require('../models/box_buyer');

module.exports = function (app) {

    app.get('/sims/list', list);
    app.get('/version/last', last);

};


//全部订阅号
function list(req,res){
    new Sim().findAll(function(sims){

        var phones = [];
        for (var i = sims.length - 1; i >= 0; i--) {
            phones[i] = 'tv' + sims[i].sim;
        };

        res.send({phone:phones});
    });
}


//最新版本
function last(req,res){
    res.send({
        version : 1,
        code : "1.0",
        name : "cloudbox_tv_android_1.0.apk",
        desc : "1.更新了xxx功能\n2.更新了xxx功能\n3.更新了xxx功能",
        url : "http://192.168.199.228:3000/uploads/apk/cloudbox_tv_android_1.0.apk",
        md5 : "973760e5d855eac42be7c5bc15920062"
    });
}

